<template>
<div>
    <Card :bordered="false">
        <Layout>
            <Content>
                <Select v-model="model7" style="width:200px"
                @on-change="selectNormal">
            <Option v-for="item in normalList" :value="item.value" 

            :key="item.value">{{ item.label }}
            </Option>
           </Select>
            </Content>
        </Layout>
    </Card>
    <Card>
        <Table :columns="columns1" :data="data1"></Table>
    </Card>
</div>
</template>

<script>
export default {
    methods: {
        selectNormal(e) {
            var nid = e;
            const axios = require('axios')
            var that = this
            var post_data = {
                mode_id: e
            }
            axios.post('/get_normal_step', post_data)
                .then(function (response) {
                    var d = response.data;
                    if(d.Code!=0){
                        alert(d.desc)
                    }else{
                        for(i in d.data){
                            
                        }
                    }
                }).catch(function (e) {}).then(function () {});
        }
    },

    created() {

        const axios = require('axios')
        var that = this
        var post_data = {
            id: -1
        }
        axios.post('/get_normal_flow', post_data)
            .then(function (response) {
                var data = response.data
                if (data.Code != 0) {
                    alert(data.desc);
                } else {
                    var d = data.data;
                    for (var i in d) {

                        var name = d[i].Name;
                        var idn = d[i].ID;
                        var ele = {
                            'value': idn,
                            'label': name
                        }
                        that.normalList.push(ele)
                    }

                }
            }).catch(function (e) {

            }).then(function () {

            })

    },
    data() {
        return {

            normalList: [],

            model7: '',
            columns1:[{
                        title: '动作序号',
                        key: 'id'
                    },
                    {
                        title: '动作内容',
                        key: 'act'
                    },
                    {
                        title: '动作参数',
                        key: 'arg'
                    }],
            data1:[]
        }
    }

}
</script>
